package client;

import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: Hp
 * Date: 27.05.11
 * Time: 2:08
 * To change this template use File | Settings | File Templates.
 */
public class PaintActionClearRectangle extends PaintAction{
    int x2,y2;
     public void mouseEnter(int x, int y)
    {
        this.x=x;
        this.y=y;
        x2 = x;
        y2 = y;
    }
    public void mouseMove(int x, int y)
    {
        this.x2=x;
        this.y2=y;
    }
    public void mouseLeave(int x, int y)
    {
        this.x2=x;
        this.y2=y;
    }

    public void draw(Graphics2D gr){
        gr.setPaint(Color.white);
        gr.fillRect(Math.min(x,x2), Math.min(y,y2), Math.abs(x2-x), Math.abs(y2-y));
    }
}
